Optimization method and device of NC program in NC machining

ABSTRACT

In NC machining in which machining control is performed through An NC program, machining conditions at the time of actual machining are reflected in the NC program. At this time, there are two types of modes comprising an analytic storage mode in which actual machining conditions are reflected in the NC program as they are and an optimization mode in which optimization processing applies to the actual machining conditions and the result is reflected in the NC machining program, and either of them is selected according to conditions.

TECHNICAL FIELD

The present invention relates to an optimization method and device of an NC program in NC machining, and more particularly to an optimization method and device of an NC program which extract various machining information or machining conditions from the NC program used for actual machining in the NC machining which performs various machining control using numerical control information, and, if this machining information or machining conditions are not optimum, to those which optimize an NC program based on the already-stored machining information or machining conditions, extract the machining information or machining conditions of this optimized actual machining program and can store this machining information in the numerically-controlled machine tool as general-purpose information or in other numerically-controlled machine tools as widely usable information.

BACKGROUND ART

Usually, unique information such as a tool indexing command, a spindle speed of revolution command, a feedrate command, a move/interpolation command and a miscellaneous function command and machining histories are built in as numerical control information such as NC programs, and the numerical control information which is a target of machining control and is suitable for a machine tool is created as an NC program each time.

The conventional numerical control information was created as a desired NC program using CAD (computer-aided design)/CAM (computer-aided manufacturing) or an automatic programming tool by assigning base material data and the final component shape. This program was eventually used in the machining control of a machine tool as an actual machining NC program by making adjustments (modification and editing) of the NC program in the field and repeating a simulation or test cut in a practical machine tool.

Thus, in a conventional NC machining system, the work at the time when numerical control information was corrected and edited was not used repeatedly, fed back or stored and made usable as know-how (technical knowledge).

To resolve this problem, such art as PCT/JP96/03264 has been researched into and developed. This art analyzes numerical control information, in particularly, an actual machining NC program whose modification and editing had been completed, and inversely extracts various machining conditions of field know-how and other various machining conditions, that is, the optimum machining information or machining conditions for specific work from the actual machining NC program which is finally used for quantity production machining in the field, and can use these machining information or machining conditions as databases. Consequently, an optimum field machining program can instantaneously be programmed automatically from these fed back databases.

Thus, in the prior art described above, the various machining information or machining conditions of an analyzed actual machining NC program can be put on the database as know-how. However, some actual machining NC programs include even an actual machining NC program whose modification and editing are completed but which is not optimum with the change of the times, an actual machining NC program in which even the same tool whose cutting conditions are not optimum due to improvements of a tool and a chip or an actual machining NC program in which whether its modification and editing are completed is unknown. Accordingly, if these actual machining NC programs are analyzed and their machining information or machining conditions are added to databases as they are, there was a problem that the databases are not optimized.

The present invention is directed toward such an issue, and an object of the present invention is to optimize an actual machining NC program even if the machining information or machining conditions of the actual machining NC program are not optimum, and to enable the machining information or machining conditions of this optimized actual machining NC program to be used as databases.

DISCLOSURE OF THE INVENTION

The present invention, in NC machining in which machining control is performed through an NC program, comprises a machining method analyzer which analyses the NC program and extracts machining information or machining conditions, a storage device which stores the machining information or machining conditions so as to be able to be rewritten and an NC program optimization device which optimizes the NC program based on the existing machining conditions stored in the storage device.

Further, the present invention comprises a mode switching device by which the NC program optimization device switches an optimization mode which optimizes the NC program based on the existing machining conditions stored in the storage device and an analytic storage mode which stores the machining conditions extracted by the machining method analyzer, in the storage device.

Furthermore, the present invention enables the NC program optimization device to optimize the NC program to a plurality of patterns based on the existing machining conditions stored in the storage device.

Moreover, the present invention enables the NC program optimization device to select an optimizing condition from a plurality of patterns based on the existing machining conditions stored in the storage device before the NC program is optimized.

Further, the present invention, in NC machining in which machining control is performed through an NC program, comprises a machining method analyzing step which analyzes the NC program and extracts machining information or machining conditions, a storage step which stores the machining conditions so that they can be rewritten and an NC program optimization step which optimizes the NC program based on the existing machining conditions stored according to the storage step.

Furthermore, the present invention comprises a mode switching step at which the NC program optimization step switches an optimization mode which optimizes the NC program based on the existing machining conditions stored according to the storage step and an analytic storage mode which stores the machining conditions extracted according to the machining method analyzing step.

Moreover, the present invention enables the NC program optimization step to optimize the NC program to a plurality of patterns based on the existing machining conditions stored according to the storage step.

Further, the present invention enables the NC program optimization step to select an optimizing condition from a plurality of patterns based on the existing machining conditions stored according to the storage step before the NC program is optimized.

As described above, according to an NC machining system related to the present invention, if the machining conditions of an actual machining NC program are not optimum, the machining method of the actual machining NC program is analyzed and the actual machining NC program can be optimized based on the existing data of a database. Then, because the machining conditions of this optimized actual machining NC program are extracted and can be put on the database, the machining conditions which are put on the database are only optimum data, and the machining conditions of the database can always be maintained in an optimized condition.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram showing the overall configuration of a numerically controlled system in which an NC optimization method and device related to the present invention are built;

FIG. 2 is a block diagram showing the principal part of an NC machining system related to the present invention in the system shown in FIG. 1;

FIG. 3A, FIG. 3B or FIG. 3C is a diagram showing an example of an actual machining NC program used in an embodiment of the present invention;

FIG. 4 is a diagram showing a base material shape used in this embodiment;

FIG. 5 is a diagram showing the final machining shape used in this embodiment;

FIG. 6 is a diagram showing a tool list used in this embodiment;

FIG. 7A, FIG. 7B, FIG. 7C, FIG. 7D or FIG. 7E is a diagram showing a G code expansion list guided from a actual machining NC program in this embodiment;

FIG. 8A is an illustration showing an example in which the machining conditions for each work element machining in this embodiment are presented as cutting condition databases;

FIG. 8B is an illustration showing the cutting condition analysis data guided from an actual machining NC program in this embodiment;

FIG. 9A, FIG. 9B or FIG. 9C is a diagram showing a result in which optimization by time priority is executed for an example of the actual machining NC program used in an embodiment of the present invention;

FIG. 10 is a diagram showing a sequence for each machining element of an actual machining program used in an embodiment of the present invention;

FIG. 11 is a diagram showing the sequence of a tool used in each machining element of a actual machining NC program used in an embodiment of the present invention;

FIG. 12A is a diagram showing the surface indexing of an actual machining NC program used in an embodiment of the present invention and a tool change list;

FIG. 12B is a diagram showing the surface indexing of an actual machining NC program used in an embodiment of the present invention and an intermediate state of the time-priority optimization of a tool change list;

FIG. 12C is a diagram showing a result in which the surface indexing of an actual machining NC program used in an embodiment of the present invention and the time-priority optimization of a tool change list were executed;

FIG. 12D is a diagram showing a result in which the surface indexing of an actual machining NC program used in an embodiment of the present invention and the precision-priority optimization of a tool change list were executed; and

FIG. 13A, FIG. 13B or FIG. 13C is a diagram showing a result in which precision-priority optimization was executed for an example of an actual machining NC program used in an embodiment of the present invention.

BEST MODE FOR CARRYING OUT THE INVENTION

In accordance with the diagrams, preferred embodiments of the present invention are described in detail below.

FIG. 1 shows the overall configuration of a numerically controlled machine tool system to which an optimization method and device of an NC program related to the present invention were applied.

In the same manner as before, an NC program is created by assigning base material data and the final component shape. In the diagram, the base material data includes a base material shape and a material. An NC program creation device 20 creates a desired NC program by adding know-how data stored in the past which is assigned from various databases to the input base material data and final component shape. In the embodiment, databases comprise a work expansion database 21, a cutting condition database 22, a tool database 23 and a machining history database 24, and past field know-how, other conditions required for practical machining and conditions peculiar to a machine tool used are supplied from each of these databases to the NC program creation device 20 as reference data to create an NC program.

The NC program created as described above and a tool list are sent to a numerical controller 25 and necessary idle operation and a test cut or simulation are performed, which is completed as an actual machining NC program finally used in the field of the numerical controller 25 via the same NC program modification and editing as before. The modification and editing portion of such an NC program is not shown in FIG. 1 in detail.

The numerical controller 25 includes an NC program execution device 27, a servo controller 28 and an error compensator 29 to drive a machine tool 26, and the NC program, tool list and base material data are input to the NC program execution device 27 respectively. The NC program execution device 27, referring to the measurement result described later, performs interpolation processing based on an appropriate feedrate according to each of the input data to supply a servo control signal to the servo controller 28 and enables feed drive control of the machine tool 26 conforming to an NC program by an output drive signal of the servo controller 28. The error compensator 29 is installed to compensate for position or dimensional errors caused by temperature changes of the machine tool 26 and can compensate for the errors resulting from temperatures using the output of a measuring device installed in the machine tool 26.

Thus, the machine tool 26 executes desired work element machining, machining of an element to be machined and process machining for a workpiece 30 loaded on a table in accordance with an NC program, and completes machining in the first attitude of the workpiece 30.

When the process machining of the workpiece 30 is completed according to the first attitude, a measuring device 31 measures the coordinates of the workpiece 30 in accordance with the measurement program of a measuring controller 32. This measurement result is fed back to the NC program execution device 27 of the numerical controller 25 and a machining method analyzer 34 via a measurement result analyzer 33, and as occasion demands, this measurement result is supplied to each of the databases 22, 23 and 24. Thus, according to the embodiment shown, desired numerically controlled machining can be applied to the workpiece 30 based on the created NC program. Then, the attitude of the workpiece 30 is switched after the process machining in the first attitude has been completed and the machining which conforms to the NC program is continuously performed in the second attitude in the same manner as above.

In the conventional PCT application art described previously, the contents of an actual machining NC program which is executed in the numerical controller 25 are appropriately analyzed and machining information such as machining know-how included in this NC program is extracted, and this extracted machining information can be stored so that it can be rewritten. The machining information is extracted from the analysis result of the NC program as the machining conditions for each work element machining and these machining conditions are stored in a storage device corresponding to each work element machining.

According to an optimization method and device of an NC program related to the present invention, in addition to the analytic storage of machining information in the prior art, if such machining conditions for each work element machining cannot be introduced as they are, they are supplied to various databases by executing new optimization processing further.

In the present invention, such two types of machining condition extraction storage are handled as an analytic storage mode for the former and as an optimization mode for he latter.

First, the optimization of an NC program disclosed in a conventional PCT application art and introduced as the analytic storage mode of the present invention is described.

In FIG. 1, a machining program, a tool list and a measurement result are supplied to the machining method analyzer 34 and necessary machining information is extracted in accordance with predetermined algorithms. Then, such extracted machining information is supplied to a database creation device 35 and the machining information classified by item is written to and stored in each database described previously, that is, the work expansion database 21, the cutting condition database 22, the tool database 23 and the machining history database 24 as the machining conditions which correspond to each work element machining.

Accordingly, after the actual machining of the workpiece has been performed by the machine tool 26, each of the databases 21 to 24 ordinarily introduces the machining information such as field know-how reflected in this actual machining and the contents of the database can be updated. These contents can be reflected in current machining and usually the machining information can be assigned as an optimum database when the next NC program is created.

As described above, according this machining system, the field know-how and other machining information are used only for the modification and editing of an original NC program, and other machining information are inversely analyzed and extracted from an already-modified actual machining NC program used for final field machining. Accordingly, a great advantage is obtained in that this result can immediately be reflected in a database. Due to the reflection of work information in such a database, an NC program creation device can create a program containing the latest and field know-how at all times, and there is an advantage that the modification and editing work from an original machining program to an actual machining program can be made much more simple than before.

Further, in the case of reflection of such machining information in a database, for example, the machining information can be reflected in the database before several machining elements are machined after actual machining has started, and can immediately be applied to readjustment of a subsequent NC program or the current NC program.

Furthermore, according to this system, each database in which the machining information described previously was reflected can be arbitrarily applied to any machine tool which is constituting a CIM (computer integrated manufacturing) system. Needless to say, even if a base material or the final component shape is changed, the portion of a database related to a machine tool or a tool can be converted as it is. By releasing such data to all terminal devices which constitute the CIM system, it can also be used in creation of any numerical control information or the execution of this creation. Such an excellent advantage, in this embodiment, depends on the fact that the machining information is modularized as machining conditions for each and every work element machining, thereby considerably improving the general purpose usability of a stored database.

The analysis of an NC program and the extraction process of machining information or machining conditions in the machining method analyzer 34 are described below in detail according to actual examples.

FIG. 2 is an enlarged diagram of the portion of a program analyzer in the numerically controlled system (FIG. 1) described above. An actual machining NC program, base material data and a tool list are input to the machining method analyzer 34 as described previously, and as occasion demands, the final machining shape and a measurement result are also input to the machining method analyzer. In the machining method analyzer 34, each of the input data is stored in a storage device 40 and an actual machining NC program is analyzed by one block. Data is converted by a numeric data converter 41 and each item of data is registered as a G code expansion list in a G code expansion list creation unit 42. At this time, if a plurality of operations are performed in one block such as a microprogram and a subprogram, the data is registered in the G code expansion list after it has been expanded into a basic instruction in accordance with the RS-274-D format. Although the expansion into this G code is not always necessary in the present invention, in this embodiment an actual machining NC program is expanded into an easy-to-analyze G code so that is can be processed by a computer.

In the machining method analyzer 34, a continuous actual machining program is split for each work element in a splitting unit 43 into a work element referring to the G code expansion list. Then, the G code expansion program split for each work element extracts the machining conditions for each work element in an extractor 45 referring to pattern definitions stored in a pattern definition unit 44. The machining conditions for each work element extracted in this manner are stored in the work expansion database 21, the cutting condition database 22, the tool database 23 and the machining history database 24 via the database creation device 35 described previously.

Usually, it is desirable that program splitting for each work element machining in the splitting unit 43 be performed paying attention to a sequence (N number), tool indexing (T code), tool change (M6) and optional stop (MO1). In fact, the program splitting into such a work element is performed paying attention to tool change in the first place. Because a single tool is used during tool change, it can be used as the end of the work element. However, because a plurality of work element machining operations may be performed using the same tool, for example, a plurality of prepared holes may be drilled by the same drill, it is desirable that a tool trace pattern be read in addition to the tool change and the splitting for each work element machining be accurately performed as a result.

The machining condition extractor 45 extracts necessary machining conditions from the program split for each work element described previously. In this embodiment, if it is difficult to directly extract a working condition, what work elements are like is recognized from a tool trace and a work shape within a split range and this result is temporarily created as a workpiece database or each pattern list. As such a pattern list, for example, a drilling element list for drilling is listed.

In this embodiment, the machining conditions described previously are written to each database for each work element machining. As general machining conditions, a machined base material, a tool used and each cutting condition are stored and retained as related data for each work element machining. In this case, it is desirable that the cutting conditions be formed into data as a cutting speed, feed per tooth and feed per revolution of each tool, not as a speed of revolution or feedrate of a tool used usually. Accordingly, modularized data of general purpose usability can be created, and the cutting conditions of an approximate tool diameter can be calculated from these base data.

Thus, various machining conditions are reflected in an NC program in conformity with actual machining. According to this analytic storage mode, the best result can be obtained by faithfully reflecting the practically actual machining in an NC program in many cases.

However, as described previously, it may not always be optimum that in all cases actual machining data is reflected in the NC program as it is. In such a case, in the present invention, the NC program can always be optimized in a new environment by selecting an optimization mode, applying optimization processing to machining conditions thereby and reflecting the machining conditions edited to various databases.

Therefore, in FIG. 1 and FIG. 2, the output of the machining method analyzer 34 is not only supplied directly to the database creation device 35 but is also selectively supplied to an NC program editing device 36, as described previously. Accordingly, whether the machining conditions extracted by the machining method analyzer 34, i.e., the machining condition extractor 45 shown in FIG. 2 in detail are supplied to the database creation device 35 or supplied to the NC program editing device 36 in accordance with the mode selected by the operator is alternatively selected.

It constitutes a characteristic feature of the present invention that if an optimization mode is selected, predetermined editing is applied to the actual machining conditions and the optimization condition after this NC program has been edited is reflected in various databases.

In the present invention, the selection between the analytic storage mode and the optimization mode is performed by allowing the operator to select either of the modes before an NC program is analyzed.

Next, the optimization processing executed in the NC program editing device 36 will be described.

Optimization

If the data obtained by making an analysis from an actual machining NC program is compared with the data in the databases 22, 23 and 24 to be input originally and the same machining conditions are provided, the actual machining NC program is corrected under these conditions.

For example, it is assumed that the optimization of cutting conditions such as a width of cut, depth of cut, spindle speed is performed. At this time, if machining information whose part of the cutting conditions is the same can be found in the cutting condition database 22, for example, if the type of machining such as pocket machining and tapping and a tool used are the same, the machining information is used as it is.

On the other hand, if such machining information cannot be found in a database, a piece of or a plurality of similar machining information are selected, and in comparison with the machining conditions which are considered to be optimum are indexed for use. For example, pocket machining and side machining are substantially considered identical in machining conditions. Further, if the type of machining and the type of a tool are identical but there is not the same condition in a tool diameter and there are two different conditions of the tool diameter, their ratios are calculated and the conditions in the case of the relevant tool diameter are indexed.

Furthermore, if such similar machining conditions that can be compared as described above cannot be found in the database, the optimization of the portion is not performed and the reflection of machining conditions in an NC program is also not performed.

Optimization of Machining Method

Next, for example, in a machining tool path through which the peripheral machining of a large circle is performed on the base material of a rectangular parallelepiped, for such a tool path through which an actual machining NC program allows even an idle cutting portion to travel at the same feedrate as a cutting portion, the actual machining NC program is changed to such a machining method where the idle cutting portion travels linearly at a rapid traverse.

Further, in machining in relation to a plurality of surfaces, if a machining method in which priority is given to a surface and a machining method in which priority is given to a tool are stored in a database, the tool change time and indexing time of a machine tool which performs the machining are compared, and whether surface-priority machining is performed or tool-priority machining is performed is judged. If the judgment result and the actual machining NC program differ, the actual machining NC program is changed.

Furthermore, the sequence of tools used is optimized so that the number of tool change times can be reduced.

In the present invention, there are two types of optimization. One optimization type can be selected after the optimization has been completed, or the other optimization can be selected when the optimization starts.

By performing these two types of optimization, two actual machining NC programs are created. The operator checks these programs and selects an optimum one. Otherwise, if which optimization is to be performed is predetermined, only the optimization is performed if it is specified before optimization.

Optimization by Machining Time Priority (Speedup)

A width of cut and a depth of cut are set so that the number of depth of cut times can be reduced within the allowable range of machining conditions.

An idle cutting portion travels linearly at a rapid traverse.

For surface priority or tool priority, a machining method whose machining time is short is selected. Optimization by Machining Surface Priority (High Precision)

Emphasis is placed on cutting conditions.

Even if there is an idle cutting portion, the portion does not travel linearly at a rapid traverse but a tool path through which a series of movements are performed is used.

Even if the machining of a plurality of surfaces is performed, it is performed by surface priority.

One Example of Program Optimization

FIG. 3A, FIG. 3B or FIG. 3C shows an example of an actual machining NC program used in this embodiment, and a program number 00001 is assigned to the NC program.

FIG. 4 shows a base material shape machined in this actual machining NC program. Further, FIG. 5 shows the final machining shape manufactured from the base materials shown in FIG. 4 by this actual machining program, and these base material data (including materials) and the final machining shape are supplied to the machining method analyzer 34 as data, as described previously. As is evident from FIG. 5, in this machining, the top facing and side facing of a base material, and the circle side machining of the top face, two drilling with chamfers and the tapping of the front face are requested.

FIG. 6 shows the tool list used in a program 00001, and each tool number is indicated by a T code. Each tool data is listed as shown in the diagram and this tool list is supplied to the machining method analyzer 34 as described previously. As shown in FIG. 2, in the machining method analyzer 34, first, after an actual machining NC program has been stored in the memory 40, it is converted to a G code expansion list which is easily analyzed by a computer, by the G code expansion list creation unit 42 via the numeric data converter 41.

FIG. 7A, FIG. 7B, FIG. 7C, FIG. 7D or FIG. 7E show a list of states in which the actual machining program 00001 is expanded to a G code, and both are linked by a line number and their contents are substantially the same.

FIG. 8B shows a cutting condition database among the machining conditions extracted for each work element by splitting the G code expansion list of the actual machining program 00001 created in this manner for each work element.

Also, FIG. 8A shows a past cutting condition database extracted and stored in the same manner as above, and shows the cutting condition database indicated by the code 22 in FIG. 1 and FIG. 2.

Based on the examples shown in FIG. 3 to FIG. 8 above, specific examples of optimization processing in this embodiment are described below.

<Optimization by Time Priority>

1) Emphasis is not laid on cutting conditions and the number of width of cut times is reduced.

Cutting condition analysis data and the conditions having the same contents are retrieved from the cutting condition database 22. If the same items (a work element, work material and tool number) are provided, the cutting conditions are compared. If the data of the cutting condition database is larger in a cutting speed, feed per tooth, feed per revolution, width of cut and depth of cut, a actual machining program is corrected based on the conditions.

For example, in the facing roughing (N1 machining of a actual machining program) of a tool number 1, while the depth of cut 2.5 mm for the cutting condition analysis data, it is 4.9 mm for the cutting condition database. Accordingly, in accordance with the conditions of the cutting condition database, the N1 portion of the actual machining program is corrected (N1 portion of the optimization by time priority sample NC program of FIG. 9A).

Further, while, in the side roughing of the cutting condition analysis data, depth of cut of a tool number 5 is 15.0 mm, the depth of cut of the tool number 5 of the cutting condition database is 19.9 mm. A width of cut also differs between the two. This is because a work element differs like side roughing and pocket roughing, and the difference is not considered regarding the data of the width of cut. However, if the final width of cut is smaller than other width of cut, a tool path whose number of width of cut times is reduced by once and the width of cut for the part is evenly allocated to other width of cut is created. For this actual machining program, because the final width of cut is not smaller than other width of cut, a one-time width of cut is not corrected. Accordingly, regarding the depth of cut of the cutting condition database, the N2 portion of the actual machining program is corrected according to conditions (N2 portion of the optimization by time priority sample NC program of FIG. 9A or FIG. 9B).

2) An idle cutting portion travels at a rapid traverse.

In facing, a portion which is traveling at a cutting feed is corrected to a rapid traverse when the Z axis descends to an approach point or moves from one cutting portion to another cutting portion. At this time, an approach distance when a rapid traverse is shifted to a cutting feed and an escape distance when the cutting feed is shifted to the rapid traverse are stored in a numerical controller. In this example, it is assumed that the approach distance at the first Z-axis approach is 10 mm, the approach or escape distance during machining is 3.00 mm, and an actual machining program shall be corrected (N1, N2 or N3 portion of the optimization by time priority sample NC program of FIG. 9A or FIG. 9B).

3) For the priority of a surface or tool, a method having a short time is used and the optimization of a tool sequence is also considered.

First, the optimization of a tool sequence is considered. FIG. 10 is a diagram showing a sequence for each machining element and FIG. 11 is a diagram showing a sequence of a tool used in each machining element.

Referring to FIG. 10 and FIG. 11, the end mill of a tool number 5 is used twice, and its use in the M10 tapping is for spot-facing (counterbore) machining after drilling has been performed by a center drill and a drill. Because the center drill and drill are used even for 20 mm diameter drilling after a circle side face which uses the end mill of the tool number 5 has been machined, the use of this end mill is impossible sometimes. Accordingly, the optimization of a tool sequence is judged to be no longer possible.

Next, the optimization in which surface indexing and tool change are taken into account is considered. FIG. 12A is the surface indexing and tool change list of this actual machining program.

First, referring to FIG. 12A, because there is a tool which machines two surfaces, the sequence of a machining surfaces with the same tool is adjusted so as to become the same as the machining surfaces of tools in the front and in the rear. For the tool of a tool number 1, the former tool is the number 9 used machining the surface of G55 at the end of the program. The later tool is the number 5 tool for machining the surface of G54. Accordingly, it is desirable that the machining sequence of the surface of the tool of the tool number 1 be set to G54 rather than G55. The tool of the tool number 2 shall be used as it is because both the tool in front and the tool in the rear perform machining of the G54 surface. Also the tool of a tool number 8 shall be used as it is because both the tool in front and the tool in the rear perform machining of the G55 surface (refer to FIG. 12B).

Further, it is considered from FIG. 10 and FIG. 11 whether the number of surface indexing times is reduced by changing the sequence of a tool so that the machining sequence of a machining element and the sequence of a tool used for each machining element can be made consistent. Because the sequence of facing, circle side machining and 20 mm diameter drilling cannot be changed, it can be judged from FIG. 10 that the sequence of a tool number 1, 5, 6, 2, 3 or 8 cannot be changed. Because the 20 mm diameter drilling and the M10 tapping are common in the tool numbers 2 and 8, it can be judged to be acceptable even if the machining sequence of the tool number 3 may be located in any position of a tool number 4, 5 or 7. Because the tool number 8 is a tool which machines two surfaces, the tool of the tool number 3 travels intermediately before the tool of the tool number 8. In that case, because the machining of the tool number 3 which performs machining of the surface of G54 is omitted, the machining of the surface of G55 before and behind it can be performed without surface indexing (refer to FIG. 12C). Consequently, the surface indexing which required eight times is reduced to four times.

The optimization by time priority corrects an actual machining program as described above (refer to FIG. 9A, FIG. 9B or 9C).

<Optimization by Precision Priority>

1) Emphasis is placed on cutting conditions.

In the same manner as the optimization by time priority, the cutting condition analysis data and the conditions having the same contents are retrieved from the cutting condition database. If the same items (a work element, work material and tool number) are provided, the cutting conditions are compared. If the data of the cutting condition database is larger in a cutting speed, feed per tooth, feed per revolution, or a one-time cutting width and depth of cut, an actual machining program is corrected based on the conditions of cutting condition database.

For example, for the facing roughing and side roughing of the tool number 1, in the same manner as the optimization by time priority, depth of cut conforms to the conditions of cutting condition database and an actual machining program is corrected (N1 or N2 section of the optimization by precision priority sample NC program of FIG. 13A). Also for the difference in the data of the one-time width of cut of the tool of the tool number 5, an actual machining program is not corrected conforming to the conditions of cutting condition database even if a work element differs in the same manner as the optimization by time priority. Further, because the cutting speed condition of chamfering can be found as only 23 m/min in the cutting condition database, the portion of the cutting speed 33 m/min in the chamfering of an actual machining program is corrected to 23 m/min as shown below (N9 portion of the optimization by precision priority sample NC program of FIG. 13C). S=1000V/πD=1000·23/(π·21)=348.625 . . . ≈350

2) Even if an idle cutting portion is provided, the portion does not travel linearly at a rapid traverse and a tool path in which a series of movements are performed is used.

Like the side roughing or finishing of the optimization by time priority, an attempt is not made to correct the traveling portion from one cutting portion to another cutting portion to a rapid traverse. Further, if such a program is used from the beginning, unlike the optimization by time priority, the linear rapid traverse portion between one cutting portion and another shall also use a cutting feed and an attempt is made not to split the program into a plurality of blocks (a plurality of lines) in a series of tool paths. This is because like the optimization program by time priority, an error in a unit of one thousandth millimeter can be prevented from occurring in the switching position between the cutting and rapid traverse portions.

However, in facing, the portion where the Z axis descends to an approach point is corrected to a rapid traverse (N1, N2 or N3 of the optimization by precision priority sample NC program of FIG. 13A or 13B).

3) A program by surface priority is used and the optimization of a tool sequence is also considered.

First, the sequence of an actual machining program shown as in FIG. 12A is corrected to the actual machining program which successively performs machining on the same surface (refer to FIG. 12D). At this time, this sequence is made consistent with the machining sequence of a machining element of FIG. 10 and the sequence of a tool used for each machining element of FIG. 11.

Next, the optimization of a tool sequence is considered within the same surface. This is performed in the same manner as the optimization by time priority. In this case, a plurality of similar tools are not used within the same surface.

The optimization by precision priority corrects an actual machining program as described above (refer to FIGS. 13A, 13B or 13C).

When both types of optimization are completed as described above, the operator can check both optimized actual machining programs and selects either of them. Accordingly, the mode is automatically switched to an analytic storage mode and moreover, the selected actual machining program can also be corrected. Subsequently, machining and measurement are performed. The data is also input to a machining method analyzer and the machining information and machining conditions are input to various databases.

Besides, in the optimization described above, if there are a plurality of relevant conditions of cutting condition database for correcting an actual machining program, the operator can be allowed to select them at that time. Further, in such a case, it is also acceptable that the cutting condition data which is automatically used most frequently is selected.

Moreover, in both types of optimization, if it is known before optimization which type of optimization is to be performed, either optimization can also be selected when the mode is switched to an optimization mode, and in this case, when the optimization is completed, the mode is automatically switched to an analytic storage mode. 

What is claimed is:
 1. An optimization device for an NC program in NC machining in which machining control is performed through the NC program, comprising: a machining method analyzer which analyzes the NC program and extracts machining information or machining conditions; a storage device which stores said machining information or machining conditions so as to be rewritable; and an NC program optimization device which optimizes said NC program based on at least existing machining conditions extracted from one or more prior NC programs and stored in said storage device.
 2. The optimization device of the NC program in the NC machining according to claim 1, wherein said NC program optimization device comprises a mode switching device which switches an optimization mode which optimizes said NC program based on the existing machining conditions stored in said storage device and an analytic storage mode which stores the machining conditions extracted by said machining method analyzer in said storage device.
 3. The optimization device of the NC program in the NC machining according to claim 1, wherein said NC program optimization device can optimize said NC program to a plurality of patterns based on the existing machining conditions stored in said storage device.
 4. The optimization device of the NC program in the NC machining according to claim 1, wherein said NC program optimization device can select an optimizing condition from a plurality of patterns based on the existing machining conditions stored in said storage device before said NC program is optimized.
 5. An optimization method of an NC program in NC machining in which machining control is performed through the NC program, comprising: a machining method analysis step which analyses the NC program and extracts machining information or machining conditions; a storage step which stores said machining conditions so as to be rewritable; and an optimization step which optimizes said NC program based on at least existing machining conditions extracted from one or more prior NC programs and stored according said storage step.
 6. The optimization method of the NC program in the NC machining according to claim 5, wherein said NC program optimization step comprises a mode switching step which switches the optimization mode which optimizes said NC program based on the existing machining conditions stored according to said storage step and the analytic storage mode which stores the machining conditions extracted according to said machining method analysis step, according to said storage step.
 7. The optimization method of the NC program in the NC machining according to claim 5, wherein said NC program optimization step can optimize said NC program to a plurality of patterns based on the existing machining conditions stored according to said storage step.
 8. The optimization method of the NC program in the NC machining according to claim 5, wherein said NC program optimization step can select an optimizing condition from a plurality of patterns based on the existing machining conditions stored according to said storage step before said NC program is optimized. 